function error_x = calculate_error(delta_para, DH_para, x_real, Q)
[n, ~] = size(Q);

Alpha = DH_para.Alpha;
A = DH_para.A;
D = DH_para.D;
Theta = DH_para.Theta;

Theta(1) = Theta(1) + delta_para(1);
Theta(2) = Theta(2) + delta_para(2);
Theta(3) = Theta(3) + delta_para(3);
Theta(4) = Theta(4) + delta_para(4);
Theta(5) = Theta(5) + delta_para(5);
Theta(6) = Theta(6) + delta_para(6);

D(1) = D(1) + delta_para(7);
A(3) = A(3) + delta_para(8);
A(4) = A(4) + delta_para(9);
D(4) = D(4) + delta_para(10);
D(5) = D(5) + delta_para(11);
D(6) = D(6) + delta_para(12);

for i = 1:6
    L(i) = Link('alpha',Alpha(i),'a', A(i),'d', D(i)); L(i).offset = Theta(i); L(i).qlim=[-pi, pi]; L(i).mdh = 1;
end

robot = SerialLink(L, 'name', 'UR');
for i = 1:n
    qi = Q(i, :);
    x_th(3*i-2:3*i, 1) = robot.fkine(qi).t;
end
error_x = x_real - x_th;